package com.yxb.category.service.impl;

import java.util.List;
import com.yxb.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yxb.category.mapper.CategoryMapper;
import com.yxb.category.domain.Category;
import com.yxb.category.service.ICategoryService;

/**
 * 家教分类Service业务层处理
 * 
 * @author 林德炫
 * @date 2025-03-04
 */
@Service
public class CategoryServiceImpl implements ICategoryService 
{
    @Autowired
    private CategoryMapper categoryMapper;

    /**
     * 查询家教分类
     * 
     * @param categoryId 家教分类主键
     * @return 家教分类
     */
    @Override
    public Category selectCategoryByCategoryId(Long categoryId)
    {
        return categoryMapper.selectCategoryByCategoryId(categoryId);
    }

    /**
     * 查询家教分类列表
     * 
     * @param category 家教分类
     * @return 家教分类
     */
    @Override
    public List<Category> selectCategoryList(Category category)
    {
        return categoryMapper.selectCategoryList(category);
    }

    /**
     * 新增家教分类
     * 
     * @param category 家教分类
     * @return 结果
     */
    @Override
    public int insertCategory(Category category)
    {
        category.setCreateTime(DateUtils.getNowDate());
        return categoryMapper.insertCategory(category);
    }

    /**
     * 修改家教分类
     * 
     * @param category 家教分类
     * @return 结果
     */
    @Override
    public int updateCategory(Category category)
    {
        return categoryMapper.updateCategory(category);
    }

    /**
     * 批量删除家教分类
     * 
     * @param categoryIds 需要删除的家教分类主键
     * @return 结果
     */
    @Override
    public int deleteCategoryByCategoryIds(Long[] categoryIds)
    {
        return categoryMapper.deleteCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除家教分类信息
     * 
     * @param categoryId 家教分类主键
     * @return 结果
     */
    @Override
    public int deleteCategoryByCategoryId(Long categoryId)
    {
        return categoryMapper.deleteCategoryByCategoryId(categoryId);
    }
}
